package day1.demo1_arraylist;

import java.util.*;

public class Test1 {
    public static void main(String[] args) {
//        int[]arr = new int[10];
        ArrayList<String> arr = new ArrayList<>();
        arr.add("one");
        arr.add("two");
        arr.add("two");
        arr.add("three");

//        arr.remove(1);
//        arr.remove("two");
        for (int i = 0; i < arr.size(); i++) {
            System.out.println(arr.get(i));
        }
        System.out.println(arr.indexOf("two"));
        System.out.println(arr.lastIndexOf("two"));
        System.out.println(arr.indexOf("dddd"));
        List<String> list = arr.subList(1, 3);


        for (String s : list) {
            System.out.println(s);
        }

        Iterator<String> it = list.iterator();
        while (it.hasNext()){
            System.out.println(it.next());
        }

    }
}
